<%@ page language="java" pageEncoding="UTF-8"%>
<%@include file="/views/common/include/taglib.jsp"%>
	
	<script src="${ctx}/js/controllers/order/OrderListController.js" type="text/javascript"></script>
       	  <div style="top:130px;position:fixed;height:30px;font-size: 14px;font-family: '微软雅黑';margin-left:-236px;">
				当前位置：${sessionScope.currcent_position}
          </div>
          <section>
              <section>
                <!--begin 搜索栏 -->
                <div class="order_class">
	                <div>
	                	<div style="float:left;height:30px;line-height:30px;margin-top:25px;margin-left:50px;">
	                		<div style="font-family: '微软雅黑';font-size: 14px;color:#919191;float:left;">订单编号：</div>
	                		<input id="orderNumber" style="float:left;height:30px;width:160px;" type="text" maxlength="20" value="${(not empty orderNumber)? orderNumber : ''  }" class="input-sm">
	                	</div>
	                	<div style="float:left;height:30px;line-height:30px;margin-top:25px;margin-left:20px;">
	                		<div style="font-family: '微软雅黑';font-size: 14px;color:#919191;float:left;">收货人：</div>
	                		<input id="contactor" style="float:left;height:30px;width:160px;"  type="text" maxlength="20" value="${(not empty contactor)? contactor : ''  }" class="input-sm">
	                	</div>
	                	<div style="float:left;height:30px;line-height:30px;margin-top:25px;margin-left:20px;">
	                		<span style="font-family: '微软雅黑';font-size: 14px;color:#919191;float:left;">收货电话：</span>
	                		<input id="contactorPhone" style="float:left;height:30px;width:160px;"  type="text" maxlength="20" value="${(not empty phone)? phone : ''  }" class="input-sm">
	                	</div>
	                	<a onclick="getOrderList();"><div class="search">查询</div></a>
	               	</div>
	               	<div>
	               		<div style="float:left;height:30px;line-height:30px;margin-top:25px;margin-left:50px;">
	                		<div style="font-family: '微软雅黑';font-size: 14px;color:#919191;float:left;">下单时间：</div>
	                		<input id="beginTime" style="float:left;height:30px;width:160px;" type="text" maxlength="20" onClick="WdatePicker({maxDate:'2099-12-31 23:59:59'})" value="${beginTime}" class="input-sm">
	                		<div style="font-family: '微软雅黑';font-size: 14px;color:#919191;float:left;margin-left:34px;">至</div>
	                		<input id="endTime" style="float:left;height:30px;width:160px;margin-left:28px;" type="text" maxlength="20" onClick="WdatePicker({maxDate:'2099-12-31 23:59:59'})" value="${endTime}" class="input-sm">
	                	</div>
	                	<c:if test="${sessionScope.currcent_menu == '全部订单'}">
		                	<div style="float:left;height:30px;line-height:30px;margin-top:25px;margin-left:20px;">
		                		<div style="font-family: '微软雅黑';font-size: 14px;color:#919191;float:left;">订单状态：</div>
		                		<select id="state">
		                			<option value="-1">全部</option>
		                			<option value="0" <c:if test="${state == 0}">selected</c:if>>待付款</option>
		                			<option value="1" <c:if test="${state == 1}">selected</c:if>>待确认</option>
		                			<option value="2" <c:if test="${state == 2}">selected</c:if>>待发货</option>
		                			<option value="3" <c:if test="${state == 3}">selected</c:if>>配送中</option>
		                			<option value="4" <c:if test="${state == 4}">selected</c:if>>已完成</option>
		                			<option value="5" <c:if test="${state == 5}">selected</c:if>>已取消</option>
		                		</select>
		                	</div>
	                	</c:if>
	                	<c:if test="${sessionScope.currcent_menu == '退款'}">
		                	<div style="float:left;height:30px;line-height:30px;margin-top:25px;margin-left:20px;">
		                		<div style="font-family: '微软雅黑';font-size: 14px;color:#919191;float:left;">订单状态：</div>
		                		<select id="state">
		                			<option value="-2">全部</option>
		                			<option value="6" <c:if test="${state == 6}">selected</c:if>>退款申请</option>
		                			<option value="7" <c:if test="${state == 7}">selected</c:if>>退款已确认</option>
		                			<option value="8" <c:if test="${state == 8}">selected</c:if>>退款已完成</option>
		                		</select>
		                	</div>
	                	</c:if>
	                	<c:if test="${sessionScope.currcent_menu != '全部订单' && sessionScope.currcent_menu != '退款' && sessionScope.currcent_menu != '退货'}">
	                		<input id="state" type="hidden" value="${state }">
	                	</c:if>
	                	<c:if test="${sessionScope.currcent_menu == '退货'}">
		                	<div style="float:left;height:30px;line-height:30px;margin-top:25px;margin-left:20px;">
		                		<div style="font-family: '微软雅黑';font-size: 14px;color:#919191;float:left;">订单状态：</div>
		                		<select id="state">
		                			<option value="-3">全部</option>
		                			<option value="10" <c:if test="${state == 10}">selected</c:if>>退货申请</option>
		                			<option value="11" <c:if test="${state == 11}">selected</c:if>>退货已确认</option>
		                			<option value="12" <c:if test="${state == 12}">selected</c:if>>退货已完成</option>
		                		</select>
		                	</div>
	                	</c:if>
	                	<a onclick="reset();"><div class="search" style="background-color: #DADADA;border:1px solid #CECECE;">重置</div></a>
	               	</div>
                </div>
                
                <!--end 搜索栏 -->	
                
                <div>
                	<table class="table">
                		<thead>
							<tr>
								<th width="20%" >
									<span style="margin-left: -260px;"><img style="margin-top:-1px;" src="${ctx}/images/seller/goods/order.png" /></span>
									<span class="orderline">|</span>
									<span>商品</span>
								</th>
								<th width="10%" >
									<span><img style="margin-top:-3px;" src="${ctx}/images/seller/goods/shopper.png" /></span>
									<span class="orderline">|</span>
									<span>买家</span>
								</th>
								<th width="10%">
									<span><img style="margin-top:-1px;" src="${ctx}/images/seller/goods/orderstate.png" /></span>
									<span class="orderline">|</span>
									<span>状态</span>
								</th>
								<th width="10%">
									<span><img style="margin-top:-2px;" src="${ctx}/images/seller/goods/totalprice.png" /></span>
									<span class="orderline">|</span>
									<span>总额</span>
								</th>
							</tr>
						</thead>
						
						<tbody id="tbody">
						<c:if test="${not empty order.list }">
							<c:forEach items="${order.list }" var="order" varStatus="status">
									<tr><td colspan="4" style="height:20px;background-color: #fff;border-style:none;"></td></tr>
									<tr class="order_number" >
									<td colspan="2" style="text-align:left;background-color: #f5f5f5;height:50px;border-style:none;line-height:50px;">
										<span><img style="padding: 0px 16px 3px 34px;" src="${ctx}/images/seller/goods/orderinfo.png" /></span>
										<span style="color:#262535;font-size:14px;">订单编号：${order.orderNumber}</span>
									</td>
									<td colspan="2" style="text-align:right;background-color: #f5f5f5;height:50px;border-style:none;line-height:50px;">
										<span style="color:#262535;font-size:14px;padding-right: 13px;"><fmt:formatDate  value="${order.createTime}" type="both" pattern="yyyy.MM.dd HH:mm:ss" /></span>
									</td>
									</tr>
									<tr>
										<td style="text-align:left;">
											<c:forEach items="${order.orderDetails }" var="orderDetail" varStatus="status">
												<p>
													<span>
														<c:if test="${orderDetail.goodsLogo != null}">
															<a onclick="orderDetail(${order.id});"><img width="70px;" height="70px;"  style="margin: 16px 0px 16px 30px;border-radius: 10px;" src="${sessionScope.image_logo}${orderDetail.goodsLogo }" /></a>
														</c:if>
														<c:if test="${orderDetail.goodsLogo == null}">
															<a onclick="orderDetail(${order.id});"><img width="70px;" height="70px;"  style="margin: 16px 0px 16px 30px;border-radius: 10px;" src="${ctx}/images/seller/common/defaultgoods.jpg" /></a>
														</c:if>
													</span>
													<span>${orderDetail.goodsName}</span>
													<span>&times;${orderDetail.amount}</span>
												</p>
												<c:if test="${!status.last }">
													<p style="border-bottom: 1px solid #f5f5f5;"></p>
												</c:if>
											</c:forEach>
										</td>
										<td>
											<p style="margin: 15px 0px;"><img style="margin-top:-2px;float: left;margin-left:40px;" src="${ctx}/images/store/contactor.png" />${order.contactor}</p>
											<p style="margin: 15px 0px;"><img style="margin-top:-2px;float: left;margin-left:40px;" src="${ctx}/images/store/contactorPhone.png" />${order.contactorPhone}</p>
										</td>
										<td>
											<c:if test="${order.state == 0}">
												<p>待付款</p>
											</c:if>
											<!--商品属于需要确认那一类  -->
											<c:if test="${order.state == 1 && order.isNeedConfirm == 1}">
												<p>待确认</p>
												<p style="margin-top:10px;">
													<div class="orderchange">
														<!--点击确认，如果商品是配送那一类，不自提，跳转待发货  -->
														<c:if test="${order.distributionType == 1 && order.isBySelf == 0}">
															<a style="color: #F0AE3B;font-size: 14px;" onclick="changeState('${order.id}','${order.state}',1);">确&nbsp;&nbsp;认</a>
														</c:if>
														
														<!--点击确认，如果商品是配送那一类并且自提，或者商品不是配送那一类，都跳转待消费  -->
														<c:if test="${(order.distributionType == 1 && order.isBySelf == 1) || order.distributionType == 0}">
															<a style="color: #F0AE3B;font-size: 14px;" onclick="changeState('${order.id}','${order.state}',2);">确&nbsp;&nbsp;认</a>
														</c:if>
													</div>
													<div class="orderchange">
														<a style="color: #F0AE3B;font-size: 14px;" onclick="changeState('${order.id}','${order.state}',3);">拒&nbsp;&nbsp;绝</a>
													</div>
												</p>
											</c:if>
											<!--商品属于需要确认那一类  -->
											<c:if test="${order.state == 2}">
												<p>待发货</p>
												<p style="margin-top:10px;">
													<div class="orderchange1">
														<!--点击发货，跳转待收货订单（3）  -->
														<a style="color: #F0AE3B;font-size: 14px;" onclick="changeState('${order.id}','${order.state}');">发&nbsp;&nbsp;货</a>
													</div>
												</p>
											</c:if>
											<c:if test="${order.state == 3}">
												<p>配送中</p>
											</c:if>
											<c:if test="${order.state == 4}">
												<p>已完成</p>
											</c:if>
											<c:if test="${order.state == 5}">
												<p>已取消</p>
											</c:if>
											<c:if test="${order.state == 6}">
												<p>退款申请</p>
												<p style="margin-top:10px;">
													<div class="orderchange">
														<!--点击同意，跳转待退款订单（7）  -->
														<a style="color: #F0AE3B;font-size: 14px;" onclick="changeState('${order.id}','${order.state}',4);">同&nbsp;&nbsp;意</a>
													</div>
													<div class="orderchange">
														<!--点击拒绝，跳转待确认（1）  -->
														<a style="color: #F0AE3B;font-size: 14px;" onclick="changeState('${order.id}','${order.state}',5);">拒&nbsp;&nbsp;绝</a>
													</div>
												</p>
											</c:if>
											<c:if test="${order.state == 7}">
												<p>退款已确认</p>
											</c:if>
											<c:if test="${order.state == 8}">
												<p>退款已完成</p>
											</c:if>
											<c:if test="${order.state == 9}">
												<p>待消费订单</p>
											</c:if>
											<c:if test="${order.state == 10}">
												<p>退货申请</p>
												<p style="margin-top:10px;">
													<div class="orderchange">
														<!--点击同意，跳转退货已确认（11）  -->
														<a style="color: #F0AE3B;font-size: 14px;" onclick="changeState('${order.id}','${order.state}',6);">同&nbsp;&nbsp;意</a>
													</div>
													<div class="orderchange">
														<!--点击拒绝，跳转已完成订单（4）  -->
														<a style="color: #F0AE3B;font-size: 14px;" onclick="changeState('${order.id}','${order.state}',7);">拒&nbsp;&nbsp;绝</a>
													</div>
												</p>
											</c:if>
											<c:if test="${order.state == 11}">
												<p>退货已确认</p>
											</c:if>
											<c:if test="${order.state == 12}">
												<p>退货已完成</p>
											</c:if>
											<c:if test="${order.state == 14}">
												<p>配送已送达</p>
											</c:if>
										</td>
										<td>
											<p>${order.totalPrice }</p>
											<p><a style="" onclick="orderDetail('${order.id}');">订单详情</a></p>
										</td>
									</tr>
							</c:forEach>
						</c:if>
					</tbody>

                	<tfoot>
		            	<tr>
			               <td colspan="4">
			                  <div>
			                    <div style="float:right;margin-top: 48px;font-family: '微软雅黑'"> 
				                  <div style="float:left;">                 
				                      <ul class="footer_ul">
				                      	<c:if test="${order.hasPreviousPage }">
				                        <li onclick="gotoPage(${currentPage-1 });"><a class="leftRight">&lt;&lt;</a></li>
				                      	</c:if>
				                        <c:if test="${order.firstPage > 1}">
				                        	<li onclick="gotoPage(1);" style="border: 1px solid #9A9A9A;">
				                             	<a>1</a>
				                        	</li>
				                        	<c:if test="${order.firstPage > 2}">
				                        		...
				                        	</c:if>
				                      	</c:if>
				                        <c:forEach items="${order.navigatepageNums }" var="page">
				                        <li onclick="gotoPage(${page });" class="<c:if test="${currentPage == page }">active</c:if>" style="border: 1px solid #9A9A9A;">
				                             <a>${page}</a>
				                        </li>
				                        </c:forEach>
				                        <c:if test="${order.lastPage < order.pages}">
				                        	<c:if test="${order.firstPage < order.pages - 1}">
				                        		...
				                        	</c:if>
				                        	<li onclick="gotoPage(${order.pages});" style="border: 1px solid #9A9A9A;">
				                             	<a>${order.pages}</a>
				                        	</li>
				                      	</c:if>
				                        <c:if test="${order.hasNextPage }">
				                        <li><a onclick="gotoPage(${currentPage+1});" class="leftRight">&gt;&gt;</a></li>
				                      	</c:if>
				                      </ul>
			                     </div>
		                   		<div style="float:left;  height: 28px;line-height: 28px;">
									<span style="color: #9A9A9A;">跳转到</span> 
									<input class="inputclass" id="pageNo" onkeydown="if(event.keyCode==13){event.keyCode=0;return false;}" type="text" value="${currentPage }" style="width:26px;height:26px" onkeyup = "checInputNum(this)">
									<span style="color: #9A9A9A;">页</span> 
									<span class="buttonclass" id="J_JumpTo" onclick="gotoGoodsInfoPage(null);"><a>GO</a></span>
								</div>
			                 </div>
			                 </div>
							</td>
						</tr>
					</tfoot>
				</table>
                </div>
              </section>
             </section>
              
		<script type="text/javascript">
		var ctx = '${ctx}';
		setCtx(ctx);
		
		//实现选中取消切换图片
		$("tbody td>img").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    //$(this).parents("tr").children().each(function(){
			   // $(this).css("background","#D3F0F1");
		   //});    
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    //$(this).parents("tr").children().each(function(){
			    //$(this).css("background","");
		   //});
		    });
		    
		//实现全选切换所有选项图标
		$("#all").toggle(function(){    
		    $(this).attr("src","${ctx }/images/tables/honggou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/honggou.png");  
		},function(){    
		    $(this).attr("src", "${ctx }/images/tables/wugou.png"); 
		    $("tbody td>img").attr("src","${ctx }/images/tables/wugou.png");  
		    });
		
	</script>
	<!-- 解决ie 6 7 8 9不能显示placeholder的问题 -->
	<script src="${ctx}/js/lib/jquery.JPlaceholder.js"></script>
